<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="emb.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath %>">
    
    <title>My JSP 'viewButton.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	--> 
	<%
	 response.setDateHeader("expires", 0);
	 String srr = (String)request.getParameter("token");
	 String sid=  (String)request.getParameter("idoc");
	 String realPath = request.getRealPath("/");
	 //System.out.println("token:"+srr);
	 //System.out.println("token:"+sid);
	 %>
	 <link href="css/box.css" rel="stylesheet" type="text/css" />
	 <script type="text/javascript" src="js/lightBox.js"></script>
	 <script type="text/javascript" src="js/lightBoxPart.js"></script>
	 <link rel='stylesheet' href='css/zTreeStyle.css' type='text/css'>
	 <script type='text/javascript' src='js/jquery-1.4.4.js'></script>
     <script type='text/javascript' src='js/jquery.ztree.all-3.4.js'></script>
<script type="text/javascript">
function testPath()
{
 alert('"<%=realPath %>"');
}
function testa()
 {
  var doc;
	if(document.all){//IE
	doc = document.frames["ifrChild1"].document;
	}else{//Firefox
	doc = document.getElementById("ifrChild1").contentDocument;
	}
	try{
	  //var doc2 = doc.frames["ifrChild1"].document;
	  var p = document.frames["ifrChild1"].window;
	  //var resultValue = doc2.body.innerHTML;
	//document.getElementById("cme").value=doc3.frames["dlg"].document.body.innerHTML;
	 alert("保存");
	 p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
	 p.save("saveAS");
	 //p.Csave();
	 //p.resetStatesCB(); p.DS.bUndoableAction=true; p.saveStateCB();
     //p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
	}catch(e){alert("webi:err:"+e);}
	

  //var b = p.document.getElementById("dlg");
  //alert("p:"+p.innerHTML);
  //alert(b.innerHTML);
  //p.resetStatesCB(); p.DS.bUndoableAction=true; p.saveStateCB();
  //p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
 }
 function test2()
 {
  var doc;
	if(document.all){//IE
	alert("IE");
	doc = document.frames["ifrChild1"].document;
	}else{//Firefox
	alert("Firefox");
	doc = document.getElementById("ifrChild1").contentDocument;
	}
	var resultValue = doc.body.innerHTML;
	
	alert(resultValue); 
	
 }
 function testb()
 {
  var doc;
	if(document.all){//IE
	doc = document.frames["ifrChild1"].document;
	}else{//Firefox
	doc = document.getElementById("ifrChild1").contentDocument;
	}
	try{
	 var p = document.frames["ifrChild1"].window;
	//document.getElementById("cme").value=doc3.frames["dlg"].document.body.innerHTML;
	 alert("刷新");
	 p.Crefresh();
	 //p.resetStatesCB(); p.DS.bUndoableAction=true; p.saveStateCB();
     //p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
	}catch(e){alert("webi:err:"+e);}
 }
 function testsdk()
 {
	var	footerhtml1='<input type="image" alt="取消" src="box/cancel_button.gif"  class="btn" id="msg1cancel" />'
	+'<input type="image" alt="提交查询" src="box/ok_button.gif"  class="btn" id="msg1okBtn" />';
    var  htmlbody = getHtmls(prompts);
    Box("msg1",635,300,htmlbody,footerhtml1);
}
 function testas()
 {
  alert("23");
  var querySave;
  var p = document.frames["ifrChild1"].window;
  var input1 = document.getElementById("inputid").value; 
  p.SecondDlgFrame.location="../BOE/CMC/1308200853/AnalyticalReporting/webiDHTML/viewer/language/zh_CN/html/ajaxOpenOrSaveAsDialogSDK4.html?inputStr="+input1;
 
  //document.getElementById("cme").value=p.SecondDlgFrame.document.body.innerHTML;
  //
 }
 function UrlSave(url)
 {
  var p = document.frames["ifrChild1"].window;
  //alert("开始:"+url);
  p.DlgFrame.location="../BOE/CMC/1308200853/AnalyticalReporting/webiDHTML/viewer/"+url;
 }
 
 function getVls(obj)
 {
		  for(var i=0; i<obj.length; i++)
		{
		   var pt=prompts[i];
		   //for(var j=0;j<pt.)
		}
 }
  function newFiless(objs)
  {
   setTimeout("updateId()",2000);
  }
  
  function testas1()
 {
  var p = document.frames["ifrChild1"].window;
   alert(p.strDocID);
 }
 function updateId()
 {
  var p = document.frames["ifrChild1"].window;
  try{
   if(p.strDocID=="undefined"||p.strDocID==undefined)
   {
       setTimeout("updateId()",2000);
   }else
   {
       alert(p.strDocID);
   }
  }catch(e){setTimeout("updateId()",2000);}
 }
 
 var prompts=[{
	"visible":true,"isSAPRegularVariable":false,"answerType":"Multi","type":1,
	"isOptional":false,"hasNP":false,"groupIndex":1,"id":"输入 Quarter-app","dataType":2,
	"hasDefinitiveAnswer":false,"values":[],"level":0,"defaultValues":[],
	"isKeydate":false,"isConstrained":false,"dataproviders":["Query 1"],
	"dataproviderInfo":[{
		"id":"DP1","memberSelectionMode":"complex",
		"name":"Query 1"
	}],
	"name":"输入 Quarter-app","escapedName":"输入&nbsp;Quarter-app",
	"lov":{
		"isPartialResult":false,"isLovDelegatedSearch":false,
		"columns":[{
			"title":"Quarter ","sortType":-1
		}],
		"searchOnDBAllowed":false,"isKindOfHierarchy":false,"columnBound":0,"isHierarchical":false,
		"lastRefreshDate":"2013-8-26 17:15:49","id":"UNIVERSELOV_DS1.DOba","isWithKey":false,"dataType":2,
		"values":[{
			"value":{
				"childrenCount":0,"levelUuid":"","hasChild":false,"caption":"Q1","levelIndex":0
			},
			"row":["Q1"]},{"value":{"childrenCount":0,"levelUuid":"","hasChild":false,"caption":"Q2","levelIndex":0},"row":["Q2"]},{"value":{"childrenCount":0,"levelUuid":"","hasChild":false,"caption":"Q3","levelIndex":0},"row":["Q3"]},{"value":{"childrenCount":0,"levelUuid":"","hasChild":false,"caption":"Q4","levelIndex":0},"row":["Q4"]}],"searchInKeyAllowed":false,"selectMode":1,"getHierarcChunkValues":false,"isRefreshable":true,"showSearch":true},"key":"1"},{"visible":true,"isSAPRegularVariable":false,"answerType":"Multi","type":1,"isOptional":false,"hasNP":false,"groupIndex":2,"id":"输入以下各项的值 Year-new","dataType":2,"hasDefinitiveAnswer":false,"values":[],"level":0,"defaultValues":[],"isKeydate":false,"isConstrained":false,"dataproviders":["Query 1"],"dataproviderInfo":[{"id":"DP1","memberSelectionMode":"complex","name":"Query 1"}],"name":"输入以下各项的值 Year-new","escapedName":"输入以下各项的值&nbsp;Year-new","lov":{"isWithKey":false,"id":"UNIVERSELOV_DS1.DObc","searchInKeyAllowed":false,"isLovDelegatedSearch":false,"selectMode":1,"getHierarcChunkValues":false,"searchOnDBAllowed":false,"isRefreshable":true,"isKindOfHierarchy":false,"showSearch":true,"isHierarchical":false},"key":"2"}];
 
 </script>
 
  </head>
  
  <body>
  <FORM name="LoginForm" action="view" method="post">
  	<TABLE>		
	<TR>
		<TD>
			测试页面按钮层：<input type="button" name="test1" value="测试1" onClick="test2()"/>
			<input type="button" name="test1" value="测试保存" onClick="testa()"/>
			<input type="button" name="test1" value="测试刷新" onClick="testb()"/>
			<input type="button" name="test1" value="路径" onClick="testPath()"/>
			<input type="button" name="" value="直接刷新" onClick="testsdk()">
			<input type="button" name="" value="另存为" onClick="testas()">
			<input type="button" name="" value="获取现在ID" onClick="testas1()"><input type = "text" id = "inputid"></TD>
			<!--<TD><textarea  id="cme" name="cme"></textarea></TD>
			
	--></TR></TABLE>
  <%
	String tokeTemp = "";
	//String[] tt= tokeTemp.split("@");
	//String sHomeURL = "http://172.17.79.14:8080/BOE/OpenDocument/opendoc/openDocument.jsp?token=" + srr + "&iDocID="+sid+"&ViewType=I";
	//String openUrl = "";
	/*
	http://172.17.79.14:8080/BOE/OpenDocument/1308200853/AnalyticalReporting/webiDHTML/viewer/viewDocument.jsp?id=4921
&ViewType=I
&actId=3990&pvl=zh_CN&bttoken=MDAwRGw2MFJGSDNbMFREbVhBZjFRQmFmST1FVEpeODAEQ
&loc=zh_CN&appKind=OpenDocument
&cafWebSesInit=true&bypassLatestInstance=true&isApplication=true
&service=%2FOpenDocument%2FappService.do&objIds=4921&appCUID=AZXgyG8_ue9OtYITUhGG.wg&containerId=4903
&pref=
maxOpageU%3D10%3BmaxOpageUt%3D200%3BmaxOpageC%3D10%3Btz%3DAsia%2FShanghai%3BmUnit%3Dinch%3BshowFilters%3Dtrue%3BsmtpFrom%3Dtrue%3BpromptForUnsavedData%3Dtrue%3B
&kind=Webi
&iventrystore=widtoken&entSession=CE_ENTERPRISESESSION&lang=zh_CN
	*/
	String url1 ="http://172.17.79.14:8080/BOE/CMC/1308200853/AnalyticalReporting/webiDHTML/viewer/viewDocument3.jsp?"
	+"id="+sid
	+"&ViewType=I"
	+"&actId=3990"
	+"&pvl=zh_CN&loc=zh_CN"
	+"&bttoken="+srr
	+"&appKind=CMC"
	+"&cafWebSesInit=true"
	+"&bypassLatestInstance=true&showApply=true"
	+"&service=%2Fadmin%2FApp%2FappService.jsp"
	+"&objIds="+sid
	+"&&showSingleChildAction=true&containerId=4903&pref=maxOpageU%3D%3BmaxOpageUt%3D200%3BmaxOpageC%3D%3Btz%3DAsia%2FShanghai%3BmUnit%3D%3BshowFilters%3Dtrue%3BsmtpFrom%3Dtrue%3BpromptForUnsavedData%3Dfalse%3B"
	+"&kind=Webi"
	+"&iventrystore=widtoken"	
	+"&entSession=CE_ENTERPRISESESSION&lang=zh_CN";
	String url ="http://172.17.79.14:8080/BOE/OpenDocument/1308200853/AnalyticalReporting/webiDHTML/viewer/viewDocument.jsp?id=4921&ViewType=I&actId=3990&pvl=zh_CN&bttoken=MDAwRGw2MFJGSDNbMFREbVhBZjFRQmFmST1FVEpeODAEQ&loc=zh_CN&appKind=OpenDocument&cafWebSesInit=true&bypassLatestInstance=true&isApplication=true&service=%2FOpenDocument%2FappService.do&objIds=4921&appCUID=AZXgyG8_ue9OtYITUhGG.wg&containerId=4903&pref=maxOpageU%3D10%3BmaxOpageUt%3D200%3BmaxOpageC%3D10%3Btz%3DAsia%2FShanghai%3BmUnit%3Dinch%3BshowFilters%3Dtrue%3BsmtpFrom%3Dtrue%3BpromptForUnsavedData%3Dtrue%3B&kind=Webi&iventrystore=widtoken&ViewType=H&entSession=CE_ENTERPRISESESSION&lang=zh_CN"; %>
	<iframe id="ifrChild1" name="ifrChild1" src="" border="1" height="789" width="1024"></iframe>
</FORM>
  </body>
</html>
